import StateManager
import sqlite3

user = "pj"
name = "01.m3u8"
name = "20110217T194209-01-117814.ts"
#name = "20110217T194209-01-117815.ts"
#name = "bipbop3_6.m3u8"
#name = "YellowPages.ts"

#inst = StateManager.StateMgr()
#inst.HandleGET(user, name)

a = "./02.m3u8"
print "a: ", a
print "trim:", a.lstrip('./')
print "%s" % float(1.05)

connection = sqlite3.connect("cutoff.db")
connection.row_factory = sqlite3.Row
row = None

cursor = connection.cursor()

cursor.execute("CREATE TABLE IF NOT EXISTS " + "CutOff" + " ( \
        " + "adTrigger" + " TEXT PRIMARY KEY);")

connection.isolation_level = None
connection.commit()

clist = ["a", "b"]
#clist = [ ("a"), ("b"), ("c")]
clist = []
clist.append("abc")
clist.append("def")
clist.append("ghi")
#cursor.executemany("INSERT INTO cutoff(adTrigger) values (?) ", clist)
#cursor.executemany("INSERT INTO " + "CutOff_TABLE" + " \
#(" + "adTrigger_FIELD" + """) values (%s) """, clist)
#for item in clist:
#    cursor.execute("INSERT INTO " + "CutOff" + " \
#    (" + "adTrigger" + ") values (?) ", [item])
    
cursor.execute("SELECT " + "adTrigger" + "\
 FROM " + "cutoff")
row = cursor.fetchall()
res = []
#res.extend(row[0])
print "res", res
for item in row:
    val = item[0]
    print val
    res.append(val)
print "res", res
